package com.chenjiagou.service.impl;

import com.chenjiagou.mapper.LoginMapper;
import com.chenjiagou.pojo.User;
import com.chenjiagou.service.LoginService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class LoginServiceImpl implements LoginService {

    @Autowired
    private LoginMapper loginMapper;

    @Override
    public User login(String username, String password) {
        User user = loginMapper.findUserByUsernameAndPassword(username, password);
        if (user != null && user.getStatus() != 1) {
            // 用户存在但被禁用
            return null;
        }
        return user;
    }
}
